package com.test.design.example2.abstractfactorymethod;

import com.test.design.example2.dto.MacDialog;
import com.test.design.example2.dto.cxcp.Button;
import com.test.design.example2.dto.cxcp.Dialog;
import com.test.design.example2.abstractfactory.UIFactory;
import com.test.design.example2.abstractfactory.impl.MacFactory;
import com.test.design.example2.abstractfactory.impl.WindowsFactory;
import com.test.design.example2.dto.WindowsButton;

/**
 * @program: design-patternz
 * @description: 使用抽象工厂方法
 * @author: <a href="mailto:zhengjiaming@gtmap.cn">zhengjiaming</a>
 * @create: 2024-12-26 11:16
 **/
public class UseAbstractFactory {
    public static void main(String[] args) {
        if (false){
            WindowsButton windowsButton = new WindowsButton();
            windowsButton.setYs("黄色");
            windowsButton.setDx("50px");
            System.out.println(windowsButton);

            MacDialog macDialog = new MacDialog();
            macDialog.setBj("黑色");
            macDialog.setWz("居中");
            System.out.println(macDialog);
        }else {
            UIFactory windowsFactory = new WindowsFactory();
            Button windowsButton = windowsFactory.createButton();
            Dialog windowsDialog = windowsFactory.createDialog();
            System.out.println(windowsButton.click());
            System.out.println(windowsDialog.type());

            MacFactory macFactory = new MacFactory();
            Button macButton = macFactory.createButton();
            Dialog macDialog = macFactory.createDialog();
            System.out.println(macButton.click());
            System.out.println(macDialog.type());

        }
    }
}
